﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using CXMLStudioIDE;
using CXMLStudioIDE.Common;

namespace CXMLStudioIDE.Common.Entities
{
    public class ContextCollection : CollectionBase
    {
        #region Methods

        public Context this[int index]
        {
            get
            {
                return ((Context)List[index]);
            }
            set
            {
                List[index] = value;
            }
        }

        public int Add(Context value)
        {
            return (List.Add(value));
        }

        public bool Contains(Context value)
        {
            // If value is not of type Int16, this will return false.
            return (List.Contains(value));
        }

        public int IndexOf(Context value)
        {
            return (List.IndexOf(value));
        }

        public int IndexOf(int ContextID)
        {
            int result = -1;
            for (int i = 0; i < List.Count; i++)
            {
                Context s = List[i] as Context;
                if (s.ID == ContextID)
                    result = i;
            }
            return result;
        }

        public void Insert(int index, Context value)
        {
            List.Insert(index, value);
        }

        public void Remove(Context value)
        {
            List.Remove(value);
        }

        #endregion

    }
}
